package com.zhanghp.demo01.grade;

import com.zhanghp.demo01.visitor.UnitVisitor;

import java.util.Arrays;

/**
 * @author zhanghp
 * @date 2022-08-10 10:03
 */
public abstract class Unit {

    private final Unit[] CHILD_ARRAYS;

    public Unit(Unit ... unit){
        this.CHILD_ARRAYS = unit;
    }

    public void accept(UnitVisitor visitor){
        Arrays.stream(CHILD_ARRAYS).forEach(child -> child.accept(visitor));
    }
}
